<template>
	<van-row>
	  <van-col span="24">
		  <ShoppingList @lists="lists" :list = "list"></ShoppingList>
	  </van-col>
	  <van-col span="24">
		  <ShoppingOrder :num="num"></ShoppingOrder>
	  </van-col>
	  <!-- 底部导航 -->
	  <tabBar :userName="userName" :length="0" :dot = "dot"></tabBar>
	</van-row>
</template>

<script>
	import tabBar from '@/components/home_page/tabBar.vue'
	import ShoppingList from '@/components/Shopping/ShoppingList.vue'
	import ShoppingOrder from '@/components/Shopping/ShoppingOrder.vue'
	
	export default {
		components: {
			tabBar,
			ShoppingList,
			ShoppingOrder
		},
		data(){
			return {
				userName: 2,
				dot:true,
				list:[],
			}
		},
		created() {
			this.lists()
		},
		computed: {
			num: function() {
				let result = 0
				this.list.map((e)=>{
					result +=e.price*1
				})
				return result
			}
		},
		methods:{
			lists(){
				let user =JSON.parse(localStorage.getItem('user')).member_id
				this.$store.dispatch('user/vuexShoppingCartList',user)
				.then(e => {
					console.log(e.data.data,'购物车');
					this.list = e.data.data
					// this.total_prices()
				})
			}
		}
	}
</script>

<style>
</style>
